package com.lwl.Utils;

import java.util.List;
import java.util.Map;
import java.util.Set;

public class PrintUtil {
    public static void printArray(int[] array) {
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i] + "  ");
        }
        System.out.println();
    }

    public static <T> void printArray(T[] array) {
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i] + "  ");
        }
        System.out.println();
    }

    public static void printArray(char[] array) {
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i] + "  ");
        }
        System.out.println();
    }

    public static void printArray(int[][] array) {
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array[0].length; j++) {
                System.out.print(array[i][j] + " ");
            }
            System.out.println();
        }
        System.out.println();
    }

    public static void printArray(boolean[][] array) {
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array[0].length; j++) {
                System.out.print(array[i][j] + " ");
            }
            System.out.println();
        }
        System.out.println();
    }

    public static <K, V> void printMap(Map<K, V> map) {
        for (Map.Entry<K, V> entry : map.entrySet()) {
            System.out.println("[" + entry.getKey() + "," + entry.getValue() + "]");
        }
        System.out.println();
    }

    public static <V> void printList(List<V> list) {
        for (V v : list) {
            System.out.print(v + " ");
        }
        System.out.println();
    }

    public static <V> void printSet(Set<V> set) {
        for (V v : set) {
            System.out.print(v + " ");
        }
        System.out.println();
    }
}
